<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录注册页面</title>
    <style>
        body,
        h1,
        form {
            margin: 0;
            padding: 0;
        }

        body {
            font-family: Arial, sans-serif;
            background-color: #f7f7f7;
        }

      .container {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

      .box {
            border: 2px solid #000;
            padding: 1px;
            height: 600px;
            width: 600px;
            background-color: #ddd;
        }

      .form-group {
            margin-bottom: 10px;
        }

      .form-group label {
            display: block;
            margin-bottom: 3px;
        }

      .form-group input {
            width: 90%;
            padding: 10px;
            border: 1px solid gray;
            border-radius: 2px;
        }

      .form-group button {
            width: 90%;
            padding: 8px;
            border: none;
            border-radius: 2px;
            background-color: green;
            color: white;
            cursor: pointer;
        }

      .form-group button:hover {
            background-color: blue;
        }

      .form-group a {
            display: block;
            text-align: center;
            margin-top: 8px;
            color: white;
            text-decoration: none;
        }

      .form-group2 a {
            display: block;
            text-align: center;
            margin-top: 8px;
            color: #337ab7;
            text-decoration: none;
        }
    </style>
</head>

<body>
    <div class="container" style="text-align: center;">
        <div class="box" id="loginForm">
            <h2>登录</h2>
            <form id="loginForm">
                <div class="form-group">
                    <label for="loginPhone">帐号</label>
                    <input type="text" id="loginPhone" name="phone" required>
                </div>
                <div class="form-group">
                    <label for="loginPassword">密&nbsp;&nbsp;&nbsp;&nbsp;码</label>
                    <input type="password" id="loginPassword" name="password" required>
                </div>
                <div class="form-group">
                    <button type="submit">登录</button>
                </div>
                <div class="form-group2">
                    <a href="#" onclick="toggleForms()">去注册</a>
                </div>
            </form>
        </div>
        <div class="box" id="registerForm" style="display: none;" style="text-align: center;">
            <h2>注册</h2>
            <form>
                <div class="form-group">
                    <label for="registerUsername">用户名</label>
                    <input type="text" id="registerUsername" name="username" required>
                </div>
                <div class="form-group">
                    <label for="registerPhone">手机号</label>
                    <input type="text" id="registerPhone" name="phone" required>
                </div>
                <div class="form-group">
                    <label for="registerPassword">密&nbsp;&nbsp;&nbsp;&nbsp;码</label>
                    <input type="password" id="registerPassword" name="password" required>
                </div>
                <div class="form-group">
                    <label for="registerConfirmPassword">确认密码</label>
                    <input type="password" id="registerConfirmPassword" name="confirm_password" required>
                </div>
                <div class="form-group">
                    <label for="registerEmail">邮&nbsp;&nbsp;&nbsp;&nbsp;箱</label>
                    <input type="email" id="registerEmail" name="email" required>
                </div>
                <div class="form-group">
                    <button type="submit">注册</button>
                </div>
                <div class="form-group2">
                    <a href="#" onclick="toggleForms()">去登录</a>
                </div>
            </form>
        </div>
    </div>
    <script>
        function toggleForms() {
            var loginForm = document.getElementById('loginForm');
            var registerForm = document.getElementById('registerForm');
            if (loginForm.style.display === 'none') {
                loginForm.style.display = 'block';
                registerForm.style.display = 'none';
            } else {
                loginForm.style.display = 'none';
                registerForm.style.display = 'block';
            }
        }
        document.getElementById('loginForm').addEventListener('submit', function (e) {
            e.preventDefault();
            var phoneInput = document.getElementById('loginPhone');
            var passwordInput = document.getElementById('loginPassword');
            if (phoneInput.value === 'zouhao' && passwordInput.value === '000000') {
                alert('登录成功！');
				location.href="./test.html";
            } else {
                alert('登录失败！');
            }
        });
    </script>
</body>
</html>


